package com.cskaoyan.day1;

import java.sql.SQLOutput;

public class Calculator {
    public static void main(String[] args) {
        System.out.println("3+6=" + add(3, 6));
        System.out.println("6-3=" + subtract(6, 3));
        System.out.println("3*6=" + multiply(3, 6));
        System.out.println("6/3=" + division(6, 3));
        System.out.println("6*6=" + square(6));
        System.out.println("6^3=" + power(6, 3));
    }

    public static double add(double num1, double num2) {
        return num1 + num2;
    }

    public static double subtract(double num1, double num2) {
        return num1 - num2;
    }

    public static double multiply(double num1, double num2) {
        return num1 * num2;
    }

    public static double division(double num1, double num2) {
        return num1 / num2;
    }

    public static double square(double num) {
        return num * num;
    }

    public static long power(int num, int n) {
        long result = num;
        for (int i = 1; i < n; i++) {
            result *= num;
        }
        return result;
    }
}
